package bdhub.littletail.app.message.handler;

import com.google.common.base.Maps;

import java.util.Map;

import bdhub.littletail.app.message.handler.common.IMessageHandler;
import bdhub.littletail.app.message.handler.friend.AddFriendMessageHandler;
import bdhub.littletail.app.message.handler.friend.DeleteFriendMessageHandler;
import bdhub.littletail.lib.event.MsgConfig;

/**
 * 消息工厂
 *
 * Created by BDHub-7 on 2016/2/24.
 * chenshichao@outlook.com
 */
public class MessageHandlerFactory {
    private MessageHandlerFactory() {}

    private static final Map<Integer, IMessageHandler> handlers = Maps.newHashMap();

    static {
        handlers.put(MsgConfig.MSG_TYPE_ADD_FRIEND, new AddFriendMessageHandler());
        handlers.put(MsgConfig.MSG_TYPE_DEL_FRIEND, new DeleteFriendMessageHandler());
    }

    public static IMessageHandler getHandler(int msgType) {
        return handlers.get(msgType);
    }
}
